<template>
    <div class="consumerDetail">
        <el-collapse v-model="activeNames" accordion>
            <el-collapse-item title="成员基本信息" name="1">
                <el-descriptions :column="4">
                    <template #extra>
                        <el-dropdown>
                            <span class="el-dropdown-link">
                                添加相关信息
                                <el-icon class="el-icon--right">
                                    <arrow-down />
                                </el-icon>
                            </span>
                            <template #dropdown>
                                <el-dropdown-menu>
                                    <el-dropdown-item @click="CurriculumVitaeAdd">履历信息</el-dropdown-item>
                                    <el-dropdown-item @click="EducationAdd">学历信息</el-dropdown-item>
                                    <el-dropdown-item @click="DegreeAdd">学位信息</el-dropdown-item>
                                    <el-dropdown-item @click="PostionAdd">职务信息</el-dropdown-item>
                                    <el-dropdown-item @click="PostionGradesAdd">职务层级信息</el-dropdown-item>
                                    <el-dropdown-item @click="PoliceRankAdd">衔称信息</el-dropdown-item>
                                    <el-dropdown-item @click="PoliceCardAdd">警察证信息</el-dropdown-item>
                                    <el-dropdown-item @click="AssessmentAdd">年度考核信息</el-dropdown-item>
                                    <el-dropdown-item @click="RewardAdd">奖励信息</el-dropdown-item>
                                    <el-dropdown-item @click="PunishAdd">惩戒信息</el-dropdown-item>
                                </el-dropdown-menu>s
                            </template>
                        </el-dropdown>
                        <!-- <el-button-group>
                           
                            <el-button v-perms="['auth.admin/add']" type="primary" @click="CurriculumVitaeAdd">新增履历
                            </el-button> 
                            <el-button type="primary">编辑基本信息</el-button>
                        </el-button-group>-->
                    </template>
                    <el-descriptions-item label="姓名">{{
            formData.realname
        }}</el-descriptions-item>
                    <el-descriptions-item label="性别">
                        <el-tag v-if="formData.gender == 1">男</el-tag>
                        <el-tag v-else type="danger">女</el-tag>
                    </el-descriptions-item>
                    <el-descriptions-item label="身份证">{{
            formData.IdCard
        }}</el-descriptions-item>
                    <el-descriptions-item label="民族">{{ formData.Nation }}</el-descriptions-item>
                    <el-descriptions-item label="出生日期">{{
            formData.BirthDay
        }}</el-descriptions-item>

                    <el-descriptions-item label="籍贯">{{
                formData.NativePlace
            }}</el-descriptions-item>
                    <el-descriptions-item label="出生地">{{
                formData.BirthPlace
            }}</el-descriptions-item>
                    <el-descriptions-item label="成长地">{{
                formData.GrowingPlace
            }}</el-descriptions-item>
                    <el-descriptions-item label="婚姻状况">{{
                formData.MaritalStatus
            }}</el-descriptions-item>

                    <el-descriptions-item label="警号">{{
                formData.PersonalNo
            }}</el-descriptions-item>
                    <el-descriptions-item label="管理类别">{{
                formData.ManagementCategory
            }}</el-descriptions-item>
                    <el-descriptions-item label="人员类别">{{
                formData.PersonalCategory
            }}</el-descriptions-item>
                    <el-descriptions-item label="人员身份">{{
                formData.PersonalIdentity
            }}</el-descriptions-item>

                    <el-descriptions-item label="人员状态">{{
                formData.PersonalStatus
            }}</el-descriptions-item>
                    <el-descriptions-item label="所属部门">
                        {{ formData.OwnDepartment }}</el-descriptions-item>
                    <el-descriptions-item label="所属警种">{{
            formData.OwnPoliceKind
        }}</el-descriptions-item>
                    <el-descriptions-item label="人事关系所属单位">{{
                formData.OldWorkUnit
            }}</el-descriptions-item>

                    <el-descriptions-item label="加入公务员时间">{{
                formData.JoinPFDateTime
            }}</el-descriptions-item>
                    <el-descriptions-item label="参加组织日期">{{
                formData.JoinWorkDateTime
            }}</el-descriptions-item>
                    <el-descriptions-item label="现任职务">{{
                formData.CurrentPosition
            }}</el-descriptions-item>
                    <el-descriptions-item label="原任职务">{{
                formData.OriginalPosition
            }}</el-descriptions-item>

                    <el-descriptions-item label="班子成员类别">{{
                formData.TeamCategory
            }}</el-descriptions-item>
                    <el-descriptions-item label="行政班子成员 ">
                        <el-tag v-if="formData.AdministrativeTeamMember == 1">是</el-tag>
                        <el-tag v-else type="danger">否</el-tag>
                    </el-descriptions-item>
                    <el-descriptions-item label="党委班子成员">
                        <el-tag v-if="formData.PartyCommitteeTeamMember == 1">是</el-tag>
                        <el-tag v-else type="danger">否</el-tag>
                    </el-descriptions-item>
                    <el-descriptions-item label="政治面貌">
                        {{ formData.PoliticalStatus }}</el-descriptions-item>

                    <el-descriptions-item label="参加工作日期">{{
            formData.JoinWorkDateTime
        }}</el-descriptions-item>
                    <el-descriptions-item label="工龄警龄计算校正值">{{ formData.WorkAgeCorrectionValue }}
                        个月</el-descriptions-item>
                    <el-descriptions-item label="基层工作经历时间">{{ formData.BaseWorkByDate }}个月</el-descriptions-item>
                    <el-descriptions-item label="参加公安工作日期">
                        {{ formData.JoinPoliceDateTime }}</el-descriptions-item>

                    <el-descriptions-item label="警衔应加学制年限">{{ formData.PoliceRankPlusValue }}年</el-descriptions-item>
                    <el-descriptions-item label="涉密标志">
                        <el-tag v-if="formData.SecretMark == 1">是</el-tag>
                        <el-tag v-else type="danger">否</el-tag>
                    </el-descriptions-item>
                    <el-descriptions-item label="警员库标志">
                        <el-tag v-if="formData.PolicerLibraryMark == 1">是</el-tag>
                        <el-tag v-else type="danger">否</el-tag>
                    </el-descriptions-item>
                    <el-descriptions-item label="人员岗位">{{
            formData.PersonalJob
        }}</el-descriptions-item>

                    <el-descriptions-item label="户口性质">{{
                formData.AccountNature
            }}</el-descriptions-item>
                    <el-descriptions-item label="专长">{{
                formData.Speciality
            }}</el-descriptions-item>
                    <el-descriptions-item label="统计关系所在单位">{{
                formData.RelationshipUnit
            }}</el-descriptions-item>
                    <el-descriptions-item label="户籍地所在地">
                        {{ formData.ResidenceDomain }}</el-descriptions-item>

                    <el-descriptions-item label="户籍地所在地补充">
                        {{ formData.ResidenceOther }}</el-descriptions-item>
                    <el-descriptions-item label="在职状态">
                        {{ formData.status }}</el-descriptions-item>
                    <el-descriptions-item label="在职变动时间">{{
            formData.PositionChangeTime
        }}</el-descriptions-item>
                    <el-descriptions-item label="薪资变动时间">{{
                formData.newTime
            }}</el-descriptions-item>

                    <el-descriptions-item label="现工作单位">{{
                formData.WorkUnit
            }}</el-descriptions-item>
                    <el-descriptions-item label="人员编制">{{
                formData.PersonalType
            }}</el-descriptions-item>
                    <el-descriptions-item label="人员备注">{{
                formData.Remark
            }}</el-descriptions-item>
                </el-descriptions>
            </el-collapse-item>
        </el-collapse>

        <el-tabs v-model="tabName" @tab-click="tabClick">
            <el-tab-pane label="履历" name="curriculumVitaesTab"
                v-loading="loading"><!-- 所在单位	类别	身份/职务	职务级别	工资待遇	激活	起始日期	截止日期	操作 -->
                <el-table :data="CurriculumVitaeData" style="width: 100%">
                    <el-table-column prop="WorkUnit" label="所在单位" fit width="350" />
                    <el-table-column prop="Category" label="类别" />
                    <el-table-column prop="Identity" label="身份/职务" />
                    <el-table-column prop="PostLevel" label="职务级别" />
                    <el-table-column prop="Status" label="工资待遇" />
                    <el-table-column prop="IsActive" label="激活">
                        <template #default="{ row }">
                            <el-tag v-if="row.IsActive == 1">有效</el-tag>
                            <el-tag v-else type="danger">无效</el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作">
                        <template #default="{ row }">
                            <el-button link type="primary" size="small" @click="CurriculumVitaeEdit(row)">编辑</el-button>
                            <el-button link type="danger" size="small"
                                @click="CurriculumVitaeDelete(row.id)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
            <el-tab-pane label="学历" name="EducationTab" v-loading="loading">
                <el-table :data="EducationData" style="width: 100%">
                    <el-table-column prop="Name" label="学历" />
                    <el-table-column prop="JoinDate" label="入学日期" />
                    <el-table-column prop="GraduationDate" label="毕业日期" />
                    <el-table-column prop="Years" label="学年制" />
                    <el-table-column prop="SchoolName" label="学校名称" />
                    <el-table-column prop="Professional" label="专业" />
                    <el-table-column prop="SchoolType" label="单位类别" />
                    <el-table-column prop="PersonalNo" label="证书编号" />
                    <el-table-column prop="SchoolCategory" label="学校类别" />
                    <el-table-column prop="IsActive" label="激活">
                        <template #default="{ row }">
                            <el-tag v-if="row.IsActive == 1">有效</el-tag>
                            <el-tag v-else type="danger">无效</el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作">
                        <template #default="{ row }">
                            <el-button link type="primary" size="small" @click="EducationEdit(row)">编辑</el-button>
                            <el-button link type="primary" size="small" @click="EducationDelete(row.id)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
            <el-tab-pane label="学位" name="DegreeTab" v-loading="loading">
                <el-table :data="DegreeData" style="width: 100%">
                    <el-table-column prop="Name" label="学位" />
                    <el-table-column prop="StartDate" label="入学日期" />
                    <el-table-column prop="GetDate" label="授予日期" />
                    <el-table-column prop="Country" label="授予国家" />
                    <el-table-column prop="WorkUnit" label="授予单位" />
                    <el-table-column prop="Professional" label="专业名称" />
                    <el-table-column prop="CertificatNumber" label="证书编号" />
                    <el-table-column prop="LogStatus" label="记录状态" />
                    <el-table-column label="操作">
                        <template #default="{ row }">
                            <el-button link type="primary" size="small" @click="DegreeEdit(row)">编辑</el-button>
                            <el-button link type="primary" size="small" @click="DegreeDelete(row.id)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
            <el-tab-pane label="职务" name="PostionTab" v-loading="loading">
                <el-table :data="PostionData" style="width: 100%">
                    <el-table-column prop="Name" label="职务名称" />
                    <el-table-column prop="Category" label="职务类别" />
                    <el-table-column prop="OrganizationCode" label="任职机构代码" />
                    <el-table-column prop="AppointmentDate" label="批准任职时间" />
                    <el-table-column prop="Job" label="从事工作" />
                    <el-table-column prop="TypeOfWork" label="工作岗位" />
                    <el-table-column prop="AppointmentStatus" label="任职状态" />
                    <el-table-column prop="address" label="操作">
                        <template #default="{ row }">
                            <el-button link type="primary" size="small" @click="PostionEdit(row)">编辑</el-button>
                            <el-button link type="primary" size="small" @click="PostionDelete(row.id)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>

            <el-tab-pane label="职务层级" name="PostionGradeTab" v-loading="loading">
                <el-table :data="PostionGradeData" style="width: 100%">
                    <el-table-column prop="Name" label="名称" />
                    <el-table-column prop="GradeStartDate" label="起算日期" />
                    <el-table-column prop="GradeEndDate" label="终止日期" />
                    <el-table-column prop="AppointmentOrganizationName" label="批准机关名称" />
                    <el-table-column prop="AppointmentOrganizationCode" label="批准机关代码" />
                    <el-table-column prop="LogStatus" label="记录状态" />
                    <el-table-column prop="address" label="操作">
                        <template #default="{ row }">
                            <el-button link type="primary" size="small" @click="PostionGradesEdit(row)">编辑</el-button>
                            <el-button link type="primary" size="small"
                                @click="PostionGradesDelete(row.id)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
            <el-tab-pane label="衔称" name="PoliceRankTab" v-loading="loading">
                <el-table :data="PoliceRankData" style="width: 100%">
                    <el-table-column prop="Name" label="衔称" />
                    <el-table-column prop="WorkUnit" label="批准单位名称" />
                    <el-table-column prop="EffectiveDateEnd" label="终止日期" />
                    <el-table-column prop="Category" label="警衔类型" />
                    <el-table-column prop="Source" label="授衔来源" />
                    <el-table-column prop="IsActive" label="激活">
                        <template #default="{ row }">
                            <el-tag v-if="row.IsActive == 1">有效</el-tag>
                            <el-tag v-else type="danger">无效</el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作">
                        <template #default="{ row }">
                            <el-button link type="primary" size="small" @click="PoliceRankEdit(row)">编辑</el-button>
                            <el-button link type="primary" size="small" @click="PoliceRankDelete(row.id)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
            <el-tab-pane label="警察证" name="PoliceCardTab" v-loading="loading">
                <el-table :data="PoliceCardData" style="width: 100%">
                    <el-table-column prop="Number" label="警察证号" />
                    <el-table-column prop="Organization" label="发证机构" />
                    <el-table-column prop="Date" label="开始日期" />
                    <el-table-column prop="EffectiveDateFrom" label="有效日期起始" />
                    <el-table-column prop="EffectiveDateEnd" label="有效日期结束" />
                    <el-table-column prop="WorkUnit" label="办证时工作单位" />
                    <el-table-column prop="LogStatus" label="警察证状态" />
                    <el-table-column prop="address" label="操作">
                        <template #default="{ row }">
                            <el-button link type="primary" size="small" @click="PoliceCardEdit(row)">编辑</el-button>
                            <el-button link type="primary" size="small" @click="PoliceCardDelete(row.id)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
            <el-tab-pane label="年度考核" name="AssessmentTab" v-loading="loading">
                <el-table :data="AssessmentData" style="width: 100%">
                    <el-table-column prop="Year" label="考核年度" />
                    <el-table-column prop="Result" label="考核结论" />
                    <el-table-column prop="WorkUnit" label="考核单位" />
                    <el-table-column prop="WorkUnitCode" label="考核单位代码" />
                    <el-table-column prop="Date" label="考核日期" />
                    <el-table-column prop="LogStatus" label="记录状态" />
                    <el-table-column prop="address" label="操作">
                        <template #default="{ row }">
                            <el-button link type="primary" size="small" @click="AssessmentEdit(row)">编辑</el-button>
                            <el-button link type="primary" size="small" @click="AssessmentDelete(row.id)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
            <el-tab-pane label="奖励" name="RewardTab" v-loading="loading">
                <el-table :data="RewardData" style="width: 100%">
                    <el-table-column prop="Name" label="奖励名称" />
                    <el-table-column prop="Category" label="奖励类别" />
                    <el-table-column prop="OrganizationName" label="批准机关名称" />
                    <el-table-column prop="Reason" label="奖励原因" />
                    <el-table-column prop="PassDate" label="批准日期" />

                    <el-table-column label="操作">
                        <template #default="{ row }">
                            <el-button link type="primary" size="small" @click="RewardEdit(row)">编辑</el-button>
                            <el-button link type="primary" size="small" @click="RewardDelete(row.id)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
            <el-tab-pane label="惩戒" name="PunishTab" v-loading="loading">
                <el-table :data="PunishData" style="width: 100%">
                    <el-table-column prop="Category" label="惩戒类别" />
                    <el-table-column prop="OrganizationName" label="惩戒机关名称" />
                    <el-table-column prop="No" label="惩戒序号" />
                    <el-table-column prop="Reason" label="惩戒原因" />
                    <el-table-column prop="Date" label="批准日期" />
                    <el-table-column prop="address" label="操作">
                        <template #default="{ row }">
                            <el-button link type="primary" size="small" @click="PunishEdit(row)">编辑</el-button>
                            <el-button link type="primary" size="small" @click="PunishDelete(row.id)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-tab-pane>
        </el-tabs>
        <edit-popup v-if="showEdit" :member_id="member_id" ref="editRef" @close="showEdit = false" />
        <EditEducationPopup v-if="showEdit" :member_id="member_id" ref="editEducationRef" @close="showEdit = false" />
        <EditDegreePopup v-if="showEdit" :member_id="member_id" ref="editDegreeRef" @close="showEdit = false" />
        <EditPostionPopup v-if="showEdit" :member_id="member_id" ref="editPostionRef" @close="showEdit = false" />
        <EditPostionGradesPopup v-if="showEdit" :member_id="member_id" ref="editPostionGradesRef"
            @close="showEdit = false" />
        <EditPoliceRankPopup v-if="showEdit" :member_id="member_id" ref="editPoliceRankRef" @close="showEdit = false" />
        <EditPoliceCardPopup v-if="showEdit" :member_id="member_id" ref="editPoliceCardRef" @close="showEdit = false" />
        <EditAssessmentPopup v-if="showEdit" :member_id="member_id" ref="editAssessmentRef" @close="showEdit = false" />
        <EditRewardPopup v-if="showEdit" :member_id="member_id" ref="editRewardRef" @close="showEdit = false" />
        <EditPunishPopup v-if="showEdit" :member_id="member_id" ref="editPunishRef" @close="showEdit = false" />
    </div>
    <!-- @success="getLists" -->
</template>
<script setup lang="ts" name="consumerDetail">
import { ref, reactive } from 'vue'
import type { TabsPaneContext, FormInstance } from 'element-plus'
import {
    getUserDetail,
    getUserCurriculumVitaes,
    getEducations,
    getDegrees,
    getPostions,
    getPostionGrades,
    getPoliceRanks,
    getPoliceCards,
    getAssessments,
    getRewards,
    getPunishs,
    DelCurriculumVitae,
    DelEducations,
    DelDegrees,
    DelPostions,
    DelPostionGrades,
    DelPoliceRank,
    DelPoliceCards,
    DelAssessment,
    DelReward,
    DelPunish
} from '@/api/consumer'

import EditPopup from './CurriculumVitaeEdit.vue' //编辑用户履历信息
import EditEducationPopup from './EducationEdit .vue' //编辑用户学历信息
import EditDegreePopup from './DegreeEdit.vue' //编辑用户学位信息
import EditPostionPopup from './PostionEdit.vue' //编辑用户职务信息
import EditPostionGradesPopup from './PostionGradesEdit.vue' //编辑用户职务层级信息
import EditPoliceRankPopup from './PoliceRankEdit.vue' //编辑用户警衔信息
import EditPoliceCardPopup from './PoliceCardEdit.vue' //编辑用户警证信息
import EditAssessmentPopup from './AssessmentEdit.vue' //编辑用户年度考核信息
import EditRewardPopup from './RewardEdit.vue' //编辑奖励信息
import EditPunishPopup from './PunishEdit.vue' //编辑惩罚息
import feedback from '@/utils/feedback'

const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const editEducationRef = shallowRef<InstanceType<typeof EditEducationPopup>>()
const editDegreeRef = shallowRef<InstanceType<typeof EditDegreePopup>>()
const editPostionRef = shallowRef<InstanceType<typeof EditPostionPopup>>()
const editPostionGradesRef = shallowRef<InstanceType<typeof EditPostionGradesPopup>>()
const editPoliceRankRef = shallowRef<InstanceType<typeof EditPoliceRankPopup>>()
const editPoliceCardRef = shallowRef<InstanceType<typeof EditPoliceCardPopup>>()
const editAssessmentRef = shallowRef<InstanceType<typeof EditAssessmentPopup>>()
const editRewardRef = shallowRef<InstanceType<typeof EditRewardPopup>>()
const editPunishRef = shallowRef<InstanceType<typeof EditPunishPopup>>()

const showEdit = ref(false)
const loading = ref(false)
const activeNames = ref(['1'])
const tabName = ref('curriculumVitaesTab')
const handleChange = (val: string[]) => {
    console.log('ddd=', val)
}
const route = useRoute()
const member_id = ref(route.query.id)
/**用户详细信息 */
const formData = reactive({
    realname: '',
    gender: 1,
    IdCard: null,
    mobile: '',
    Telephone: null,
    Position: null,
    status: null,
    DeleterUserId: null,
    DeletionTime: null,
    IsDeleted: null,
    OrganizationUnitId: null,
    IsActive: null,
    WechatOpenId: null,
    ExtensionData: null,
    CreatorUserId: null,
    LastModificationTime: null,
    LastModifierUserId: null,
    AccountNature: null,
    AdministrativeTeamMember: null,
    BaseWorkByDate: null,
    BirthDay: null,
    BirthPlace: null,
    BloodType: null,
    CurrentPosition: null,
    GrowingPlace: null,
    HealthStatus: null,
    JoinGroupDateTime: null,
    JoinPFDateTime: null,
    JoinPoliceDateTime: null,
    JoinWorkDateTime: null,
    ManagementCategory: null,
    MaritalStatus: null,
    Nation: null,
    NativePlace: null,
    OriginalPosition: null,
    OwnDepartment: null,
    OwnPoliceKind: null,
    PartyCommitteeTeamMember: null,
    PersonalCategory: null,
    PersonalIdentity: null,
    PersonalJob: null,
    PersonalNo: '',
    PersonalSource: null,
    PersonalStatus: null,
    PoliceRankPlusValue: null,
    PolicerLibraryMark: null,
    PoliticalStatus: null,
    RelationshipUnit: null,
    Remark: null,
    ResidenceDomain: null,
    ResidenceOther: null,
    SecretMark: null,
    Speciality: null,
    TeamCategory: null,
    WorkAgeCorrectionValue: null,
    WorkUnit: null,
    WechatWorkMemberId: null,
    HealthDescription: null,
    TenantId: null,
    UserId: null,
    IsBorrow: null,
    PersonalType: null,
    WorkUnitForBorrow: null,
    Attach1: null,
    ChildFees: null,
    IsInjury: null,
    StatusChangedTime: null,
    DeleteTime: null,
    IsActionDelete: null,
    IsDelete: null,
    IsRemove: null,
    Sort: null,
    OldWorkUnit: null,
    PositionChangeTime: null,
    IsStay: null,
    newTime: null,
    TimesheetSort: null,
    PersonalNoAlias: null,
    LastNaatLogTime: null,
    AvatarState: null,
    AnnualLeaveDays: null,
    TransferType: null,
    TransferAfter: null,
    TransferBefore: null,
    TransferChangeTime: null,
    Attach1Type: null,
    login_ip: null,
    login_time: '',
    multipoint_login: 1,
    disable: 0,
    create_time: '',
    update_time: '',
    delete_time: null,
    avatar: '',
    account: ''
})
const CurriculumVitaeData = ref([]) /*履历数据*/
const EducationData = ref([]) /*学历数据*/
const DegreeData = ref([]) /*学位数据*/
const PostionData = ref([]) /*职务数据*/
const PostionGradeData = ref([]) /*职务层级数据*/
const PoliceRankData = ref([]) /*警衔信息数据*/
const PoliceCardData = ref([]) /*警证数据*/
const AssessmentData = ref([]) /*年度审核数据*/
const RewardData = ref([]) /*奖励数据*/
const PunishData = ref([]) /*惩罚数据*/

/* 切换表格*/
const tabClick = (tab: TabsPaneContext, event: Event) => {
    console.log('标签点击', tab.paneName)
    switch (tab.paneName) {
        case 'curriculumVitaesTab':
            getCurriculumVitae()
            break
        case 'EducationTab':
            getEducation()
            break
        case 'DegreeTab':
            getDegree()
            break
        case 'PostionTab':
            getPostion()
            break
        case 'PoliceRankTab':
            getPoliceRank()
            break
        case 'PoliceCardTab':
            getPoliceCard()
            break
        case 'AssessmentTab':
            getAssessment()
            break
        case 'RewardTab':
            getReward()
            break
        case 'PunishTab':
            getPunish()
            break
    }
}
//新增一个履历
const CurriculumVitaeAdd = async () => {

    showEdit.value = true
    await nextTick()
    editRef.value?.open('add')
}
const CurriculumVitaeEdit = async (data: any) => {
    showEdit.value = true
    await nextTick()
    editRef.value?.open('edit')
    editRef.value?.setFormData(data)
    getCurriculumVitae()
}
const CurriculumVitaeDelete = async (id: number) => {
    await feedback.confirm('确定要删除？')
    await DelCurriculumVitae({ id })
    getCurriculumVitae()
}

const EducationAdd = async () => {

    showEdit.value = true
    await nextTick()
    editEducationRef.value?.open('add')
}
const EducationEdit = async (data: any) => {
    showEdit.value = true
    await nextTick()
    editEducationRef.value?.open('edit')
    editEducationRef.value?.setFormData(data)
    getEducation()
}
const EducationDelete = async (id: number) => {
    await feedback.confirm('确定要删除？')
    await DelEducations({ id })
    getEducation()
}

const DegreeAdd = async () => {

    showEdit.value = true
    await nextTick()
    editDegreeRef.value?.open('add')
}
const DegreeEdit = async (data: any) => {
    showEdit.value = true
    await nextTick()
    console.log("开始读取了", data)
    editDegreeRef.value?.open('edit')
    editDegreeRef.value?.setFormData(data)
    getDegree()
}
const DegreeDelete = async (id: number) => {
    await feedback.confirm('确定要删除？')
    await DelDegrees({ id })
    getDegree()
}
const PostionAdd = async () => {

    showEdit.value = true
    await nextTick()
    editPostionRef.value?.open('add')
}
const PostionEdit = async (data: any) => {
    showEdit.value = true
    await nextTick()
    editPostionRef.value?.open('edit')
    editPostionRef.value?.setFormData(data)
    getPostion()
}
const PostionDelete = async (id: number) => {
    await feedback.confirm('确定要删除？')
    await DelPostions({ id })
    getPostion()
}

const PostionGradesAdd = async () => {

    showEdit.value = true
    await nextTick()
    editPostionGradesRef.value?.open('add')
}
const PostionGradesEdit = async (data: any) => {
    showEdit.value = true
    await nextTick()
    editPostionGradesRef.value?.open('edit')
    editPostionGradesRef.value?.setFormData(data)
    getPostionGrade()
}
const PostionGradesDelete = async (id: number) => {
    await feedback.confirm('确定要删除？')
    await DelPostionGrades({ id })
    getPostionGrade()
}
const PoliceRankAdd = async () => {

    showEdit.value = true
    await nextTick()
    editPoliceRankRef.value?.open('add')
}
const PoliceRankEdit = async (data: any) => {
    showEdit.value = true
    await nextTick()
    editPoliceRankRef.value?.open('edit')
    editPoliceRankRef.value?.setFormData(data)
    getPoliceRank()
}
const PoliceRankDelete = async (id: number) => {
    await feedback.confirm('确定要删除？')
    await DelPoliceRank({ id })
    getPoliceRank()
}
const PoliceCardAdd = async () => {

    showEdit.value = true
    await nextTick()
    editPoliceCardRef.value?.open('add')
}
const PoliceCardEdit = async (data: any) => {
    showEdit.value = true
    await nextTick()
    editPoliceCardRef.value?.open('edit')
    editPoliceCardRef.value?.setFormData(data)
    getPoliceCard()
}
const PoliceCardDelete = async (id: number) => {
    await feedback.confirm('确定要删除？')
    await DelPoliceCards({ id })
    getPoliceCard()
}
const AssessmentAdd = async () => {

    showEdit.value = true
    await nextTick()
    editAssessmentRef.value?.open('add')
}
const AssessmentEdit = async (data: any) => {
    showEdit.value = true
    await nextTick()
    editAssessmentRef.value?.open('edit')
    editAssessmentRef.value?.setFormData(data)
    getAssessment()
}
const AssessmentDelete = async (id: number) => {
    await feedback.confirm('确定要删除？')
    await DelAssessment({ id })
    getAssessment()
}
const RewardAdd = async () => {

    showEdit.value = true
    await nextTick()
    editRewardRef.value?.open('add')
}
const RewardEdit = async (data: any) => {
    showEdit.value = true
    await nextTick()
    editRewardRef.value?.open('edit')
    editRewardRef.value?.setFormData(data)
    getReward()
}
const RewardDelete = async (id: number) => {
    await feedback.confirm('确定要删除？')
    await DelReward({ id })
    getReward()
}
const PunishAdd = async () => {

    showEdit.value = true
    await nextTick()
    editPunishRef.value?.open('add')
}
const PunishEdit = async (data: any) => {
    showEdit.value = true
    await nextTick()
    editPunishRef.value?.open('edit')
    editPunishRef.value?.setFormData(data)
    getPunish()
}
const PunishDelete = async (id: number) => {
    await feedback.confirm('确定要删除？')
    await DelPunish({ id })
    getPunish()
}
/**得到用户详情 */
const getDetails = async () => {
    const data = await getUserDetail({
        id: route.query.id
    })
    Object.keys(formData).forEach((key) => {
        //@ts-ignore
        formData[key] = data[key]
    })
}
/**得到履历列表 */
const getCurriculumVitae = async () => {
    loading.value = true
    const data = await getUserCurriculumVitaes({
        id: route.query.id
    })
    CurriculumVitaeData.value = data
    console.log('履历列表', data)
    loading.value = false
}
/*得到学历列表*/
const getEducation = async () => {
    loading.value = true
    const data = await getEducations({
        id: route.query.id
    })
    EducationData.value = data
    console.log('学历列表', data)
    loading.value = false
}
/*得到学位列表*/
const getDegree = async () => {
    loading.value = true
    const data = await getDegrees({
        id: route.query.id
    })
    DegreeData.value = data
    console.log('学位列表', data)
    loading.value = false
}
/*得到职务列表*/
const getPostion = async () => {
    loading.value = true
    const data = await getPostions({
        id: route.query.id
    })
    PostionData.value = data
    console.log('职务列表', data)
    loading.value = false
}
/*得到职务层级列表*/
const getPostionGrade = async () => {
    loading.value = true
    const data = await getPostionGrades({
        id: route.query.id
    })
    PostionData.value = data
    console.log('职务列表', data)
    loading.value = false
}
/*得到警衔信息列表*/
const getPoliceRank = async () => {
    loading.value = true
    const data = await getPoliceRanks({
        id: route.query.id
    })
    PoliceRankData.value = data
    console.log('警衔列表', data)
    loading.value = false
}
/*得到警证列表*/
const getPoliceCard = async () => {
    loading.value = true
    const data = await getPoliceCards({
        id: route.query.id
    })
    PoliceCardData.value = data
    console.log('警证列表', data)
    loading.value = false
}
/*得到年度审核列表*/
const getAssessment = async () => {
    loading.value = true
    const data = await getAssessments({
        id: route.query.id
    })
    AssessmentData.value = data
    console.log('年度审核列表', data)
    loading.value = false
}
/*得到奖励列表*/
const getReward = async () => {
    loading.value = true
    const data = await getRewards({
        id: route.query.id
    })
    RewardData.value = data
    console.log('奖励列表', data)
    loading.value = false
}
/*得到惩罚列表*/
const getPunish = async () => {
    loading.value = true
    const data = await getPunishs({
        id: route.query.id
    })
    PunishData.value = data
    console.log('惩罚列表', data)
    loading.value = false
}
getDetails()
getCurriculumVitae()
</script>
<style scoped lang="scss">
.collapse-title {
    flex: 1 0 90%;
    order: 1;

    .el-collapse-item__header {
        flex: 1 0 auto;
        order: -1;
    }
}
</style>
